package com.levi.functionalinterface;

import java.util.function.Function;

/**
 * @author shentong
 * @date 2022/1/10 10:16 PM
 * @description  Function接口主要用于类型转换，有输入有返回值
 */
public class MyFunctionDemo {

    public static Integer convert(String source, Function<String,Integer> function){
        return function.apply(source);
    }

    public static void main(String[] args) {
        String source = "6";
        System.out.println(convert(source, a -> Integer.parseInt(a) + 2));
    }
}
